package CreationMode.Prototype;

/**
 * <h3>23_Design_Patterns</h3>
 * <p>
 *     浅克隆
 * </p>
 *
 * @author gdw
 * @since 2025-07-21 16:06:51
 */
public class Citation implements Cloneable{
    private String name;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public void show(){
        System.out.println("恭喜"+name+"同学，获得优秀学生奖");
    }
    @Override
    public Citation clone() throws CloneNotSupportedException {
        return (Citation) super.clone();
    }

    public static void main(String[] args) throws CloneNotSupportedException {
        Citation c1 = new Citation();
        Citation clone = c1.clone();
        c1.setName("小古");
        clone.setName("小梁");
        c1.show();
        clone.show();
    }
}
